package com.smarthome.web.property.auth;

import java.io.Serializable;

import org.apache.commons.lang.StringUtils;

public class ShiroUser implements Serializable {

    private static final long serialVersionUID = -1748602382963711884L;
    private Long userId;
    private String userName;
    private String loginName;
    private boolean superAdmin;

    public ShiroUser() {

    }

    public ShiroUser(Long userId, String userName, String loginName, boolean superAdmin) {
        super();
        this.userId = userId;
        this.userName = userName;
        this.loginName = loginName;
        this.superAdmin = superAdmin;
    }

    public String toString() {
        return loginName;
    }

    public String getUserName() {
        return StringUtils.isBlank(userName) ? loginName : userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public boolean isSuperAdmin() {
        return superAdmin;
    }

    public void setSuperAdmin(boolean superAdmin) {
        this.superAdmin = superAdmin;
    }

}
